# /usr/bin/bash

kubernetes_dashboard_token_name=`kubectl get secret -n kubernetes-dashboard | grep 'dashboard-token' | awk '{print $1}'`

#echo $kubernetes_dashboard_token_name

create_admin=`kubectl create clusterrolebinding dashboard-cluster-admin --clusterrole=cluster-admin --serviceaccount=kubernetes-dashboard:kubernetes-dashboard`

token=`kubectl describe secret $kubernetes_dashboard_token_name -n kubernetes-dashboard | grep 'token:'| awk '{print $2}'`

#echo $token

set_port=`kubectl patch svc kubernetes-dashboard -p '{"spec":{"type":"NodePort"}}' -n kubernetes-dashboard`

port=`kubectl get svc -n kubernetes-dashboard | grep 'kubernetes-dashboard' | awk '{print $5$2}' | cut -d : -f 2 | cut -d / -f 1`

domain_name="https://192.168.1.13:$port"

echo $domain_name

echo $token
